package com.hqx.order.master.feign.fallback;

import com.hqx.cloud.output.dto.User;
import com.hqx.order.master.feign.UserFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: Yz
 * @create: 2020-04-02 09:48
 **/
@Component
public class UserFeignFallbackFactory implements FallbackFactory<UserFeign> {

    @Override
    public UserFeign create(Throwable e) {
        System.out.println("错误信息："+e.getMessage());
        return new UserFeign() {
            @Override
            public User getUser() {
                return null;
            }

            @Override
            public String getString() {
                return "error";
            }
        };
    }
}
